@model FunnelWeb.Web.Areas.Admin.Views.Admin.CommentsModel
@{
  ViewBag.Title = "FunnelWeb Administration - Comments";
  Layout = "~/Areas/Admin/Views/Shared/_Private.cshtml";
}

<h1>Comments</h1>	    
<p>
  FunnelWeb comments are automatically sent to <strong><a href="http://akismet.com">Akismet</a></strong> for spam filtering.
  You can also add your own blacklist of naughty words considered as spam on the @Html.AdminActionLink("general settings", "Settings", "Admin") page.
</p>
          
<p>
  @Html.AdminActionLink("Delete all Spam", "DeleteAllSpam", "Admin")
</p>

@foreach (var comment in Model.Comments) {
<table width="90%" style="margin: 5px;background:@(comment.IsSpam ? "#fff0f0;" : "#f0f0f0;")">
  <tr>
    <td colspan="2" width="90%">
      <strong><a href="/@comment.Entry.Name/#comment-@comment.Id">@comment.Entry.Title</a></strong><br />
      @Html.DisplayFor(_ => comment.Body, new { Sanitize = true })
    </td>
  </tr>
  <tr>
    <td width="75%">
      @MvcHtmlString.Create(string.Join("<br />", new[] { "<strong>" + Html.Encode(comment.AuthorName) + "</strong>", Html.Encode(comment.AuthorEmail), Html.Encode(comment.AuthorUrl) }.Where(x => !string.IsNullOrEmpty(x)).ToArray() ))
    </td>
    <td width="25%">
      @Html.ActionLink("Delete", "DeleteComment", "Admin", new { Area = "Admin", id = comment.Id }, null)
      @Html.ActionLink(comment.IsSpam ? "Unspam" : "Spam", "ToggleSpam", "Admin", new { Area = "Admin", id = comment.Id }, null)
    </td>
  </tr>
</table>
}
